<?php
    $this->breadcrumbs = array(
        t('Customer Loan Setting') => array('index'),
        $model->loan_code,
    );

    /* $this->menu = array(
      array('label' => t('List Customer Loan Setting'), 'url' => array('index')),
      array('label' => t('Create Customer Loan Setting'), 'url' => array('create')),
      array('label' => t('Update Customer Loan Setting'), 'url' => array('update', 'id' => $model->id)),
      array('label' => t('Delete Customer Loan Setting'), 'url' => '#', 'linkOptions' => array('submit' => array('delete', 'id' => $model->id), 'confirm' => 'Are you sure you want to delete this item?')),
      array('label' => t('Manage Customer Loan Setting'), 'url' => array('admin')),
      ); */
?>

<h1><?php echo t('View Customer Loan Setting') . ' ' . $model->loan_code; ?></h1>

<?php
    /* $this->widget('bootstrap.widgets.TbDetailView', array(
      'data' => $model,
      'attributes' => array(
      array('name'=>'id',),
      //array('name'=>'customer_id',),
      array('name'=>'customer_code',),
      array('name'=>'customer.firstname',),
      array('name'=>'customer.lastname',),
      array('name'=>'loan_code',),
      array('name'=>'loan_amount',),
      array('name'=>'interest',),
      array('name'=>'period',),
      array('name'=>'period_type', 'value' => t($model->period_type)),
      array('name'=>'days_of_period',),
      array('name'=>'paying_amount',),
      array('name'=>'installments',),
      array('name'=>'payment_per_installment',),
      array('name'=>'last_period_payment',),
      array('name'=>'active', 'value' => t($model->active)),
      array('name'=>'status', 'value' => t($model->status)),
      //array('name'=>'updatedby_user_id',),
      array('name'=>'user.user_code',),
      array('name'=>'createtime',),
      array('name'=>'modifytime',),
      ),
      )); */
?>

<div class="form-actions">
    <?php
        $this->widget('bootstrap.widgets.TbButton', array(
            //'buttonType' => 'ajaxLink',
            'type' => 'primary',
            'label' => t('Back'),
            'icon' => 'icon-white icon-arrow-left',
            'htmlOptions' => array('class' => 'span1'),
            'url' => $this->createURL('customerloansetting/index'),
        ));

        if ($model->active) {
            $this->widget('bootstrap.widgets.TbButton', array(
                'buttonType' => 'Button',
                'type' => 'danger',
                'label' => t('Pay'),
                'htmlOptions' => array('class' => 'span1'),
                //'icon' => 'icon-white icon-arrow-left',
                'url' => $this->createURL('customerloanpayment/payment', array('id' => $model->id)),
            ));
        }
    ?>
</div>

<?php
    $dataProvider = new CActiveDataProvider('CustomerLoanSetting', array('data' => array($model)));
    $this->widget('bootstrap.widgets.TbGridView', array(
        'type' => 'striped bordered condensed',
        'dataProvider' => $dataProvider,
        'template' => '{items}',
        'columns' => array(
            'id',
            'customer_code',
            'loan_code',
            'loan_amount',
            'interest',
            'period',
            array('name' => 'period_type', 'value' => 't($data->period_type)'),
            'days_of_period',
            'paying_amount',
            'withdraw_amount',
            'installments',
            array('name' => 'active', 'value' => 't($data->active)'),
            array('name' => 'status', 'value' => 't($data->status)'),
            'createtime',
        ),
    ));

    $dataProvider = new CActiveDataProvider('CustomerLoanPayment', array('data' => $model->loanpayment));
    $this->widget('bootstrap.widgets.TbGridView', array(
        'type' => 'striped bordered condensed',
        'dataProvider' => $dataProvider,
        'template' => '{items}',
        'columns' => array(
            array('name' => 'installment_no', 'header' => t('Installment No.')),
            array('name' => 'pay_on_date', 'header' => t('On Date')),
            array('name' => 'payment', 'header' => t('Payment')),
            array('name' => 'paid_amount', 'header' => t('Paid Amount')),
            array('name' => 'paid_on_date', 'header' => t('Paid on Date'), 'value' => 'isset($data->paid_on_date)?date("Y-m-d", strtotime($data->paid_on_date)):""'),
            array('name' => 'remark', 'header' => t('Remark')),
        ),
    ));
?>

<div class="form-actions">
    <?php
        $this->widget('bootstrap.widgets.TbButton', array(
            //'buttonType' => 'ajaxLink',
            'type' => 'primary',
            'label' => t('Back'),
            'icon' => 'icon-white icon-arrow-left',
            'htmlOptions' => array('class' => 'span1'),
            'url' => $this->createURL('customerloansetting/index'),
        ));

        if ($model->active) {
            $this->widget('bootstrap.widgets.TbButton', array(
                'buttonType' => 'Button',
                'type' => 'danger',
                'label' => t('Pay'),
                'htmlOptions' => array('class' => 'span1'),
                //'icon' => 'icon-white icon-arrow-left',
                'url' => $this->createURL('customerloanpayment/payment', array('id' => $model->id)),
            ));
        }
    ?>
</div>
